// 弹出背景
function popBackground() {
    let backgroundBox = document.createElement("div") ;
    backgroundBox.className = "background-box";
    backgroundBox.onclick = () => { backgroundBox.remove()}
    document.body.append(backgroundBox);
}
// tipType: 消息框类型||red : yellow : green
// text : 消息框文本内容（字符型）
function popTopTip(tipType, text) {
    let tipBox = document.createElement("div");
    tipBox.className = "tip-box";
    if(tipType === "red") {
        tipBox.style.color = "#F70909";
        tipBox.style.backgroundColor = "#FFB6C1";
    }
    else if(tipType === "yellow") {
            tipBox.style.color = "#FFD700";
            tipBox.style.backgroundColor = "#FAFAD2";
        }
        else {
            tipBox.style.color = "#3c763d";
            tipBox.style.backgroundColor = "#dff0d8";
        }
    tipBox.innerText = text;
    document.body.append(tipBox);
    setTimeout(() => tipBox.remove(), 1500);
}
//发送一条提示
//text是提示的内容
function popMesBox(text) {
    let mesBox2 = document.createElement("div");
    mesBox2.className = "mes-box";
    mesBox2.innerHTML = "<span>🔴</span><div></div>";
    mesBox2.lastChild.innerText = text;
    popBackground();
    document.getElementsByClassName("background-box")[0].append(mesBox2);
    mesBox2.firstChild.onclick = function() {this.parentNode.parentNode.remove();}
}


//__________test__________
function goTest() {
    console.log("Wellcome to my website.Don't be bad!\n欢迎访问我的网站，别使坏<.<");
    popMesBox("开发者：Misspeak|失言\n2022新年快乐(´▽`ʃ♡ƪ)");
}